<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
	</head>
	<body>
		<div id="app">
			<input type="button" value="添加数据" @click="add()"/>
			<input type="button" value="移除数据" @click="remove()"/>
			<ul>
				<li v-for="(it,index) in arr">
					{{ index+1}}{{it}}
				</li>
			</ul>
			<h2 v-for="item in sg">
				{{item.name}}
			</h2>
		</div>
		<script>
			var app = new Vue({
				el:"#app",
				data:{
					arr:["长沙","武汉","杭州","苏州"],
					sg:[
						{name:"西瓜"},
						{name:"菠萝蜜"}
					]
				},
				methods:{
					add:function(){
						this.sg.push({name:"火龙果"})
					},
					remove:function(){
						this.sg.shift()
					}
				}
			})
		</script>
	</body>
</html>
